// JavaScript Document


var CsdnScriptPlugin999 = {
    /// <summary>
    /// 接口版本
    /// </summary>
    interfaceVersion: "1.0",

    /// <summary>
    /// 插件标题，显示给用户看
    /// </summary>
    caption: "由lijpwsw(q419206663)提供的个人签名插件",

    /// <summary>
    /// 设计者在CSDN的ID
    /// </summary>
    designer: "lijpwsw",

    /// <summary>
    /// 按钮对象，可选项
    /// </summary>
    buttons: {},

    /// <summary>
    /// 分隔条对象，可选项
    /// </summary>
    separators: {},
	
	/// <summary>
    /// 装载，必填项
    /// </summary>
    load: function() {
		
        this.separators["vertical"] = CsdnScriptWorkshop.addSeparator();
        this.buttons["vertical"] = CsdnScriptWorkshop.addButton(
            "由lijpwsw提供的个人签名插件",
            "http://csdn-pao-ubb.googlecode.com/svn/trunk/paopao/1.jpg",
            function() {
				var images = ["http://csdn-pao-ubb.googlecode.com/svn/trunk/paopao/pp01.GIF","http://csdn-pao-ubb.googlecode.com/svn/trunk/paopao/pp02.GIF","http://csdn-pao-ubb.googlecode.com/svn/trunk/paopao/pp03.GIF","http://csdn-pao-ubb.googlecode.com/svn/trunk/paopao/pp04.GIF","http://csdn-pao-ubb.googlecode.com/svn/trunk/paopao/pp05.GIF","http://csdn-pao-ubb.googlecode.com/svn/trunk/paopao/pp06.GIF","http://csdn-pao-ubb.googlecode.com/svn/trunk/paopao/pp07.GIF","http://csdn-pao-ubb.googlecode.com/svn/trunk/paopao/pp08.GIF","http://csdn-pao-ubb.googlecode.com/svn/trunk/paopao/pp09.GIF","http://csdn-pao-ubb.googlecode.com/svn/trunk/paopao/pp10.GIF","http://csdn-pao-ubb.googlecode.com/svn/trunk/paopao/pp100.gif","http://csdn-pao-ubb.googlecode.com/svn/trunk/paopao/pp101.gif","http://csdn-pao-ubb.googlecode.com/svn/trunk/paopao/pp102.gif","http://csdn-pao-ubb.googlecode.com/svn/trunk/paopao/pp103.gif","http://csdn-pao-ubb.googlecode.com/svn/trunk/paopao/pp104.gif","http://csdn-pao-ubb.googlecode.com/svn/trunk/paopao/pp105.gif","http://csdn-pao-ubb.googlecode.com/svn/trunk/paopao/pp106.gif","http://csdn-pao-ubb.googlecode.com/svn/trunk/paopao/pp107.gif","http://csdn-pao-ubb.googlecode.com/svn/trunk/paopao/pp11.GIF","http://csdn-pao-ubb.googlecode.com/svn/trunk/paopao/pp117.GIF","http://csdn-pao-ubb.googlecode.com/svn/trunk/paopao/pp12.GIF","http://csdn-pao-ubb.googlecode.com/svn/trunk/paopao/pp120.jpg","http://csdn-pao-ubb.googlecode.com/svn/trunk/paopao/pp123.jpg","http://csdn-pao-ubb.googlecode.com/svn/trunk/paopao/pp124.jpg","http://csdn-pao-ubb.googlecode.com/svn/trunk/paopao/pp125.jpg","http://csdn-pao-ubb.googlecode.com/svn/trunk/paopao/pp126.jpg","http://csdn-pao-ubb.googlecode.com/svn/trunk/paopao/pp128.gif","http://csdn-pao-ubb.googlecode.com/svn/trunk/paopao/pp13.GIF","http://csdn-pao-ubb.googlecode.com/svn/trunk/paopao/pp14.GIF","http://csdn-pao-ubb.googlecode.com/svn/trunk/paopao/pp15.GIF","http://csdn-pao-ubb.googlecode.com/svn/trunk/paopao/pp151.gif","http://csdn-pao-ubb.googlecode.com/svn/trunk/paopao/pp16.GIF","http://csdn-pao-ubb.googlecode.com/svn/trunk/paopao/pp17.GIF","http://csdn-pao-ubb.googlecode.com/svn/trunk/paopao/pp174.gif","http://csdn-pao-ubb.googlecode.com/svn/trunk/paopao/pp176.gif","http://csdn-pao-ubb.googlecode.com/svn/trunk/paopao/pp179.gif","http://csdn-pao-ubb.googlecode.com/svn/trunk/paopao/pp18.gif","http://csdn-pao-ubb.googlecode.com/svn/trunk/paopao/pp180.GIF","http://csdn-pao-ubb.googlecode.com/svn/trunk/paopao/pp181.GIF","http://csdn-pao-ubb.googlecode.com/svn/trunk/paopao/pp182.gif","http://csdn-pao-ubb.googlecode.com/svn/trunk/paopao/pp183.GIF","http://csdn-pao-ubb.googlecode.com/svn/trunk/paopao/pp184.gif","http://csdn-pao-ubb.googlecode.com/svn/trunk/paopao/pp185.GIF","http://csdn-pao-ubb.googlecode.com/svn/trunk/paopao/pp186.GIF","http://csdn-pao-ubb.googlecode.com/svn/trunk/paopao/pp19.gif","http://csdn-pao-ubb.googlecode.com/svn/trunk/paopao/pp190.gif","http://csdn-pao-ubb.googlecode.com/svn/trunk/paopao/pp196.gif","http://csdn-pao-ubb.googlecode.com/svn/trunk/paopao/pp197.GIF","http://csdn-pao-ubb.googlecode.com/svn/trunk/paopao/pp198.gif","http://csdn-pao-ubb.googlecode.com/svn/trunk/paopao/pp20.GIF","http://csdn-pao-ubb.googlecode.com/svn/trunk/paopao/pp200.GIF","http://csdn-pao-ubb.googlecode.com/svn/trunk/paopao/pp202.gif","http://csdn-pao-ubb.googlecode.com/svn/trunk/paopao/pp207.GIF","http://csdn-pao-ubb.googlecode.com/svn/trunk/paopao/pp21.gif","http://csdn-pao-ubb.googlecode.com/svn/trunk/paopao/pp212.GIF","http://csdn-pao-ubb.googlecode.com/svn/trunk/paopao/pp22.GIF","http://csdn-pao-ubb.googlecode.com/svn/trunk/paopao/pp23.GIF","http://csdn-pao-ubb.googlecode.com/svn/trunk/paopao/pp24.GIF","http://csdn-pao-ubb.googlecode.com/svn/trunk/paopao/pp25.GIF","http://csdn-pao-ubb.googlecode.com/svn/trunk/paopao/pp26.gif","http://csdn-pao-ubb.googlecode.com/svn/trunk/paopao/pp27.GIF","http://csdn-pao-ubb.googlecode.com/svn/trunk/paopao/pp28.GIF","http://csdn-pao-ubb.googlecode.com/svn/trunk/paopao/pp29.GIF","http://csdn-pao-ubb.googlecode.com/svn/trunk/paopao/pp30.GIF","http://csdn-pao-ubb.googlecode.com/svn/trunk/paopao/pp31.GIF","http://csdn-pao-ubb.googlecode.com/svn/trunk/paopao/pp32.GIF","http://csdn-pao-ubb.googlecode.com/svn/trunk/paopao/pp33.GIF","http://csdn-pao-ubb.googlecode.com/svn/trunk/paopao/pp34.GIF","http://csdn-pao-ubb.googlecode.com/svn/trunk/paopao/pp35.gif","http://csdn-pao-ubb.googlecode.com/svn/trunk/paopao/pp36.GIF","http://csdn-pao-ubb.googlecode.com/svn/trunk/paopao/pp37.GIF","http://csdn-pao-ubb.googlecode.com/svn/trunk/paopao/pp38.GIF","http://csdn-pao-ubb.googlecode.com/svn/trunk/paopao/pp39.GIF","http://csdn-pao-ubb.googlecode.com/svn/trunk/paopao/pp40.GIF","http://csdn-pao-ubb.googlecode.com/svn/trunk/paopao/pp41.GIF","http://csdn-pao-ubb.googlecode.com/svn/trunk/paopao/pp42.GIF","http://csdn-pao-ubb.googlecode.com/svn/trunk/paopao/pp43.GIF","http://csdn-pao-ubb.googlecode.com/svn/trunk/paopao/pp44.GIF","http://csdn-pao-ubb.googlecode.com/svn/trunk/paopao/pp73.GIF","http://csdn-pao-ubb.googlecode.com/svn/trunk/paopao/pp197.GIF","http://csdn-pao-ubb.googlecode.com/svn/trunk/paopao/pp74.GIF"];
				var htmlDialog = "";
				for($i = 0, $j = images.length ; $i<$j ; $i++)
				{
					htmlDialog += "<div id='pao_image_"+$i+"' onmouseout='imageClose("+$i+")' style='border:1px solid #008000; float:left; margin:2px;'><img src='"+images[$i]+"' width='30px' height='30px' onclick = 'showImage(this)' onmouseover = 'imageView("+$i+")' ></div>";
					
					htmlDialog += "<div id='big_pao_image_"+$i+"' style='float:left;display:none; background-color:#000'><img onmouseout='imageClose("+$i+")'  src='"+images[$i]+"' style='position:absolute; z-index:100; width:70px; height:70px; '></div>";
				}
				
                var point = absolutePoint(this); // 按钮的位置

                CsdnScriptWorkshop.showDialog("泡泡兵(<a href='http://csdn-pao-ubb.googlecode.com/svn/trunk/csdn.js' style = 'color:#3366CC'>插件地址</a>)", htmlDialog, point.x, point.y + 18, 490, 200);
                
            });
    },


    /// <summary>
    /// 卸载，必填项
    /// </summary>
    free: function() {
        for (var button in this.buttons)
            CsdnScriptWorkshop.deleteButton(this.buttons[button]);
        for (var separator in this.separators)
            CsdnScriptWorkshop.deleteSeparator(this.separators[separator]);
    }

    
};
//图片预览
function imageView(n)
{
	var obj = document.getElementById("pao_image_"+n);
	var imagepoint = absolutePoint(obj);
	var img = document.getElementById("big_pao_image_"+n);
	img.style.display = "block";
	alert(point.x);
	img.style.top = point.y;
	img.style.left = point.x-30;
}

//关闭预览图片
function imageClose(n)
{
	var img = document.getElementById("big_pao_image_"+n);
	img.style.display = "none";
}


//显示图片
function showImage($obj)
{
	var val = "";
	//val = CsdnScriptWorkshop.getEditorText();
	var img_url = $obj.src;
	val += "[img="+img_url+"][/img]";
	CsdnScriptWorkshop.setSelectText(val);
	//check();
	CsdnScriptWorkshop.closeDialog();
}


//判断是否已经加了标题


function check()
{
	
	var val_check = CsdnScriptWorkshop.getEditorText();
	if(val_check.indexOf("csdn.js")<0)
	{
		val_check += "\n\n\n============================[color=#0058B8]泡泡兵表情插件[/color]========================\n\n";
		val_check += "[color=#0058B8]插件地址 ： [/color][url=http://csdn-pao-ubb.googlecode.com/svn/trunk/csdn.js]http://csdn-pao-ubb.googlecode.com/svn/trunk/csdn.js[/url]\n";
		val_check += "[color=#FF0000]备注：此插件仅供娱乐[/color]\n";
		CsdnScriptWorkshop.setEditorText(val_check);
	}	
}
